package main

import "fmt"

type Monkey struct {
	Name string
}

//声明接口
type BidAble interface {
	Flying()
}

type FishAble interface {
	Swimming()
}

func (this *Monkey) climbing() {
	fmt.Println(this.Name, "生来会爬树")
}

//LittleMonkey结构体
type LittleMonkey struct {
	Monkey //继承
}

func (this *LittleMonkey) Flying() {
	fmt.Println(this.Name, "通过学习，会飞翔")
}

//简单理解   接口是对继承的一种补充
func (this *LittleMonkey) Swimming() {
	fmt.Println(this.Name, "通过学习，会游泳")
}

func main() {

	littleMonkey := LittleMonkey{
		Monkey{
			Name: "悟空",
		},
	}
	(&littleMonkey).climbing()
	(&littleMonkey).Flying()
	(&littleMonkey).Swimming()
}
